/*
 * @Description:
 * @version:
 * @Author: sunqian_sr
 * @Date: 2022-11-30 16:24:28
 * @LastEditors: Andy
 * @LastEditTime: 2023-01-16 20:29:30
 */
import { Http } from '@/common/api'

// ------------岗位管理-------------------/

// export const postApi = {
//   listUrl: '/upms/post/page',
//   apiGetPostTree: async (params) => Http.get('/upms/post/tree', params),
//   apiGetPostTree: async (params) => Http.get('/upms/post/tree', params),
//   apiPostAddPost: async (params) => Http.post('/upms/post/add', params),
//   apiPutEditPost: async (params) => Http.post('/upms/post/update', params),
//   apiDeletePost: async (ids) => Http.delete(`/upms/post/batch/delete/${ids}`),
//   apiPostPagePost: async (params) => Http.post(`/upms/post/page`, params)

// }
export const postPageListUrl = '/upms/post/page'
/**
 * 查询岗位树
 * @param param
 * @return {*|Promise}
 */
export const apiPostTree = async (params) => Http.post('/upms/post/tree', params)

/**
 * 新增岗位
 * @param params
 * @return {*|Promise}
 */
export const apiPostAddPost = async (params) => Http.post('/upms/post/add', params)

/**
 * 编辑岗位
 * @param params
 * @return {*|Promise}
 */
export const apiPutEditPost = async (params) => Http.put('/upms/post/update', params)

/**
 * 删除
 * @param ids
 * @return {*|Promise}
 */
export const apiDeletePost = async (ids) => Http.delete(`/upms/post/batch/delete/${ids}`)

/**
 * 分页查询职位
 * @param params
 * @return {*|Promise}
 */
export const apiPostPagePost = async (params) => Http.post('/upms/post/page', params)

/**
 * 根据ID查询职位
 * @param id
 * @return {*|Promise}
 */
export const apiGetPostInfo = async (id) => Http.get(`/upms/post/findById/${id}`)

/**
 * 启用岗位
 * @param id
 * @return {*|Promise}
 */
export const apiPutEnablePost = async (id) => Http.put(`/upms/post/enable/${id}`)

/**
 * 禁用岗位
 * @param id
 * @return {*|Promise}
 */
export const apiPutDisablePost = async (id) => Http.put(`/upms/post/disable/${id}`)

export const postExportUrl = '/upms/post/exportExcel'
// ------------部门管理-------------------

export const deptPageListUrl = '/upms/dept/page'
/**
 * 查询部门树 部门树, 如果是下拉框树,state = 1
 * @param params
 * @return {*|Promise}
 */
export const apiPostDeptTree = async (params) => Http.post('/upms/dept/tree', params)

/**
 * 新增部门
 * @param params
 * @return {*|Promise}
 */
export const apiPostAddDept = async (params) => Http.post('/upms/dept/add', params)

/**
 * 编辑部门
 * @param params
 * @return {*|Promise}
 */
export const apiPostEditDept = async (params) => Http.put('/upms/dept/update', params)

/**
 * 删除
 * @param ids
 * @return {*|Promise}
 */
export const apiDeleteDept = async (ids) => Http.put(`/upms/dept/delete?deptId=${ids}`)

/**
 * 启用部门
 * @param id
 * @return {*|Promise}
 */
export const apiPutEnableDept = async (id) => Http.put(`/upms/dept/enable/${id}`)

/**
 * 禁用部门
 * @param id
 * @return {*|Promise}
 */
export const apiPutDisbleDept = async (id) => Http.put(`/upms/dept/disable/${id}`)

/**
 * 查询部门详情
 * @param id
 * @return {*|Promise}
 */
// export const apiPostPageDept = async (params) => Http.post(`/upms/dept/page`, params)

/**
 * 分页查询部门
 * @param ids
 * @return {*|Promise}
 */
export const apiPostPageDept = async (params) => Http.post('/upms/dept/page', params)
export const deptExportUrl = '/upms/dept/exportExcel'

// ------------组织管理-------------------

export const organizPageListUrl = '/upms/org/page'
/**
 * 查询组织树
 * @param params
 * @return {*|Promise}
 */
export const apiPostOrganizTree = async (params) => Http.post('/upms/org/tree', params)

/**
 * 新增组织
 * @param params
 * @return {*|Promise}
 */
export const apiPostAddOrganiz = async (params) => Http.post('/upms/org/add', params)

/**
 * 编辑组织
 * @param params
 * @return {*|Promise}
 */
export const apiPostEditOrganiz = async (params) => Http.put('/upms/org/update', params)

/**
 * 删除
 * @param ids
 * @return {*|Promise}
 */
export const apiDeleteOrganiz = async (ids) => Http.delete(`/upms/org/batch/delete/${ids}`)

/**
 * 分页查询组织
 * @param params
 * @return {*|Promise}
 */
export const apiPostPageOrganiz = async (params) => Http.post('/upms/org/page', params)

/**
 * 根据ID查询组织
 * @param id
 * @return {*|Promise}
 */
export const apiGetOrgInfo = async (id) => Http.get(`/upms/org/findById/${id}`)

/**
 * 启用组织
 * @param id
 * @return {*|Promise}
 */
export const apiPutEnableOrganiz = async (id) => Http.put(`/upms/org/enable/${id}`)

/**
 * 禁用组织
 * @param id
 * @return {*|Promise}
 */
export const apiPutDisableOrganiz = async (id) => Http.put(`/upms/org/disable/${id}`)
/**
 * 导出组织数据
 * @param params
 * @return {*|Promise}
 */
export const orgExportUrl = '/upms/org/exportExcel'

// ------------采购组织管理-------------------

export const byOrganizPageListUrl = 'upms/purchaseGroup/page'

/**
 * 新增组织
 * @param params
 * @return {*|Promise}
 */
export const apiPostAddByOrganiz = async (params) => Http.post('/upms/purchaseGroup/add', params)

/**
 * 编辑组织
 * @param params
 * @return {*|Promise}
 */
export const apiPostEditByOrganiz = async (params) => Http.put('/upms/purchaseGroup/update', params)

/**
 * 删除
 * @param ids
 * @return {*|Promise}
 */
export const apiDeleteByOrganiz = async (ids) => Http.delete(`/upms/purchaseGroup/batch/delete/${ids}`)

/**
 * 分页查询组织
 * @param params
 * @return {*|Promise}
 */
export const apiPostPageByOrganiz = async (params) => Http.post('/upms/purchaseGroup/page', params)

/**
 * 根据ID查询组织
 * @param id
 * @return {*|Promise}
 */
export const apiGetByOrgInfo = async (id) => Http.get(`/upms/purchaseGroup/findById/${id}`)

// /**
//  * 导出组织数据
//  * @param params
//  * @return {*|Promise}
//  */
// export const apiGetByOrgInfo = async (params) => Http.post(`/upms/org/exportExcel`, params)
